package com.CGFrame.listener;

import javax.servlet.ServletRequest;
import javax.servlet.ServletRequestEvent;
import javax.servlet.ServletRequestListener;



import com.CGFrame.struts.bean.HibernateSessionFactory;
import com.CGFrame.struts.bean.ProjectOperateFactory;

public class HibernateListener implements ServletRequestListener {

	public void requestDestroyed(ServletRequestEvent arg0) {
		//HibernateSessionFactory.closeSession();
		ProjectOperateFactory.closeprojectOperate();
	//	System.out.println("closeSession....");
	//	ServletRequest request = arg0.getServletRequest();
	//	request.removeAttribute("hibernateSession");
	}

	public void requestInitialized(ServletRequestEvent arg0) {
	//	System.out.println("openSession....");
	//	Session hibernateSession = HibernateSessionFactory.getSession();
		// System.out.println(hibernateSession);
	//	ServletRequest request = arg0.getServletRequest();
	//	request.setAttribute("hibernateSession", hibernateSession);
	}

}
